home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / files / select < prev    next >
Encoding:
Text File  |  1992-12-17  |  2.3 KB  |  49 lines

  1.  
  2.  
  3.           select readhandles [writehandles] [excepthandles] [timeout]
  4.                This command allows an Extended Tcl program to wait on
  5.                zero or more files being ready for for reading,
  6.                writing, have an exceptional condition pending, or for
  7.                a timeout period to expire.  readhandles, writehandles,
  8.                excepthandles are each lists of file handles, as
  9.                returned from open, to query.  An empty list ({}) may
  10.                be specified if a category is not used.
  11.  
  12.                The files specified by the readhandles list are checked
  13.                to see if data is available for reading. The
  14.                writehandles are checked if the specified files are
  15.                clear for writing.  The excepthandles are checked to
  16.                see if an exceptional condition has occured (typically,
  17.                an error).  The write and exception checking is most
  18.                useful on devices, however, the read checking is very
  19.                useful when communicating with multiple processes
  20.                through pipes.  Select considers data pending in the
  21.                stdio input buffer for read files as being ready for
  22.                reading, the files do.  not have to be unbuffered.
  23.  
  24.                Timeout is a floating point timeout value, in seconds.
  25.                If an empty list is supplied (or the parameter is
  26.                omitted), then no timeout is set.  If the value is
  27.                zero, then the select command functions as a poll of
  28.                the files, returning immediately even if none are
  29.                ready.
  30.  
  31.                If the timeout period expires with none of the files
  32.                becomming ready, then the command returns an empty
  33.                list.  Otherwise the command returns a list of three
  34.                elements, each of those elements is a list of the file
  35.                handles that are ready in the read, write and exception
  36.                classes.  If none are ready in a class, then that
  37.                element will be the null list.  For example:
  38.  
  39.                        select {file3 file4 file5} {file6 file7} {} 10.5
  40.  
  41.                could return
  42.  
  43.                        {file3 file4} {file6} {}
  44.  
  45.                or perhaps
  46.  
  47.                        file3 {} {}
  48.  
  49.